package com.zhongkun.service.impl;

import com.zhongkun.mapper.UserMapper;
import com.zhongkun.pojo.*;

import com.zhongkun.service.UserMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserMapperServiceImpl implements UserMapperService {

    @Autowired
    private UserMapper userMapper;

    //实现登录
    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    //实现寻找所有用户 时间倒序


    @Override
    public List<User> findAllUserByTime() {
        return userMapper.findAllUserByTime();
    }

    //实现根据用户名查找用户
    @Override
    public List<User> findUserByUserName(String username) {
        return userMapper.findUserByUserName(username);
    }

    //实现根据id查询用户
    @Override
    public User findUserById(int id) {
        return userMapper.findUserById(id);
    }

    //实现根据id查某个图
    @Override
    public Picture findPictureById(int id) {
        return userMapper.findPictureById(id);
    }

    //实现根据用户查他的朋友
    @Override
    public List<Friend> findFriendByUser(User user) {
        return userMapper.findFriendByUser(user);
    }

    //实现根据用户查询所属于他的图
    @Override
    public List<Picture> findPictureByUser(User user) {
        return userMapper.findPictureByUser(user);
    }

    //实现根据用户查询所属于他的帖子
    @Override
    public List<UserShare> findShareByUser(User user) {
        return userMapper.findShareByUser(user);
    }

    //实现根据帖子查找所属于它的评论
    @Override
    public List<Comment> findCommentByShare(UserShare userShare) {
        return userMapper.findCommentByShare(userShare);
    }

    //实现根据用户查询他所发布的言论
    @Override
    public List<Comment> findCommentByUser(User user) {
        return userMapper.findCommentByUser(user);
    }
}
